/*
 * ObjectsCreate.java
 *
 * Created on November 15, 2008, 4:59 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package jollylengkono.skripsi.Objects.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jollylengkono.skripsi.dao.ObjectsDao;
import jollylengkono.skripsi.model.Objects;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author JollkY
 */
public class ObjectsCreate extends Action {
    private String FORWARD;
    private int STATE;
    
    /** Creates a new instance of ObjectsCreate */
    public ObjectsCreate() {
    }
    
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        Objects objects = (Objects) form;
        this.STATE = new ObjectsDao().create(objects);
        if (this.STATE==1) {
            this.FORWARD="success";
        } else {
            this.FORWARD="fail";
        }
        return mapping.findForward(FORWARD);
    }
}
